package main

import (
	"context"
	"fmt"
	hell_grpc "gin_grpc/grpc/pb"
	"google.golang.org/grpc"
)

func main() {
	conn, _ := grpc.Dial("localhost:8080", grpc.WithInsecure())
	defer conn.Close()
	client := hell_grpc.NewHellOGRPCClient(conn)
	req, err := client.Search(context.Background(), &hell_grpc.SearchRequest{Query: "我来C", PageNumber: 2, ResultsPerPage: 3})
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println("我是搜索的 req.Id，", req)
	//查询
	clientSelect := hell_grpc.NewSelectGRPCClient(conn)
	reqSelect, err := clientSelect.Select(context.Background(), &hell_grpc.SelectReq{ReqName: "我要查询用户"})
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println("我是 select req.Id，", reqSelect)

	//s删除
	clientDel := hell_grpc.NewDelGRPCClient(conn)
	reqDel, err := clientDel.Del(context.Background(), &hell_grpc.DelReq{ReqUserId: "我的id是多少"})
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println("我是 Del req.Id，", reqDel)
}
